Graphics exporter components have component type 'grex' and, by convention, component subtype matching the Mac OS file type for the image file format. For example, the graphics exporter for PNG files has component subtype 'PNGf' .
If you know which file format you want to write, you can use a call such as OpenADefaultComponent to open the appropriate exporter.
If you want to display a list of graphics exporter components and let the user select one, you can build a list by using FindNextComponent to search for graphics exporter components and calling GetComponentInfo on each to find out its name, as shown in Listing 17-2 .
Take care not to offer the base exporter as an option. An easy way to do this is to restrict your search to those graphics exporter components that do not have the graphicsExporterIsBaseExporter component flag set.
Listing 2 Building a list of graphics exporter components
void findGraphicsExporterComponents()
{
ComponentDescription cd;
Component c = 0;
cd.componentType = GraphicsExporterComponentType;
cd.componentSubType = 0;
cd.componentManufacturer = 0;
cd.componentFlags = 0;
cd.componentFlagsMask = graphicsExporterIsBaseExporter;
while( ( c = FindNextComponent( c, &cd ) ) != 0 ) {
// add component c to the list.
}
}
| Previous | Chapter Contents | Chapter Top | Next |